package api

import (
	"github.com/gin-gonic/gin"
	"zg3yk/api/handler"
	"zg3yk/pkg"
)

func LoadRouter(router *gin.Engine) {
	router = gin.Default()

	router.Use(pkg.Cors())
	// 简单的路由组: v1
	{
		v1 := router.Group("/v1")
		v1.POST("/login", handler.Login)
	}
	{

		chat := router.Group("/chat")
		chat.Use(pkg.JWTAuth("lx"))
		chat.GET("/chat", handler.Chat)
		chat.POST("/chatroomfind", handler.ChatFind)
		chat.POST("/chatroomadd", handler.ChatAdd)
	}
	{

		video := router.Group("/video")
		video.GET("/videoshow", handler.VideoShow)
		video.GET("/videosearch", handler.VideoSearch)

	}
	{

		DanMu := router.Group("/danmu")
		DanMu.GET("/danmucreate", handler.DanMu)

	}
	router.Run(":10002")
}
